put space & Space & peekword(address,L) after field "data"
put last word of field "data" into address
end repeat
put return & return & "Click Mouse to Exit Demo" after field "data"
wait until the mouseclick
hide field "data"
end mouseUp
-- part contents for background part 68
----- text -----
Peekword returns the unsigned 16-bit integer stored at a given address. This value is represented in hexadecimal, but you may use the HexToDec XFCN provided in this stack to convert the value to a decimal if you wish.
A typical useage of peekword would be:
put peekword("411000") into temp
On the Mac Plus, this would put the value 4CDF into the variable temp.
As an option, you may include a second parameter with the peekword XFCN. If peekword detects a second parameter, it returns a 2-line result that consists of the integer stored at the given address in the first line and the next viable address (the original address + 4) in the second line. This option provides a simple and effective way to use peekword in a script to peek into a range of addresses.
See the demo on this card for an example.
The address provided to peekword must be even or an error will result.